<template>
  <div>
    <nav-bar>
      <div slot="center">购物车({{ cartLength }})</div>
    </nav-bar>
  </div>
</template>

<script>
import NavBar from "components/common/navbar/NavBar.vue";
import { mapGetters } from "vuex";

export default {
  name: "CartNavBar",
  data() {
    return {};
  },
  components: {
    NavBar,
  },
  computed: {
    // vuex 中的 ...mapGetters()属性会将vuex中getters属性中的方法解构为计算属性，
    // 首先需要导入mapGetters
    ...mapGetters(["cartLength"]),
  },
};
</script>

<style scoped>
</style>
